Skip to content

Updates for runZero 5.1#47

Merged
hdm merged 7 commits into
mainfrom
custom-integrations-5.0
Jul 20, 2026
Merged

Updates for runZero 5.1#47
hdm merged 7 commits into
mainfrom
custom-integrations-5.0

Conversation

@hdm

@hdm hdm commented May 21, 2026

Copy link
Copy Markdown
Contributor

Updates for runZero 5.1: a bigger Starlark toolkit and self-describing integration scripts

Important

This branch requires runZero 5.1 or newer. The scripts here load builtins
(get_json, network_interface, to_custom_attributes, kwargs, the
runzero.* protocol modules, ...) and declare embedded CONFIG blocks that
only the 5.1 Explorer and console understand. Running them on an earlier
release will fail. Scripts that set minVersion enforce this automatically.

TL;DR

Every integration in this repo has been refactored onto the new 5.1 custom-integration
API surface. The result is dramatically less boilerplate, scripts that describe their
own credential form, new non-HTTP data sources, and explicit control over how imported
assets merge.

  • Far less boilerplate: auth headers, retries, pagination, IP/MAC handling, and
    custom-attribute flattening are now builtins instead of copy-pasted helpers.
  • Self-describing scripts: a CONFIG block at the top of each script renders the
    credential form, validates input, and encrypts secrets — no platform change needed
    to add a new integration.
  • New data sources: pull from SSH/SMB/WinRM/WMI and SQL databases, not just REST APIs.
  • Match control: a matchBehavior flag lets each script tell the cruncher how
    aggressively to merge the assets it imports.
  • Stable identity: every v2 script declares minVersion: "5.1.0"; random
    asset-ID fallbacks were removed so malformed records cannot create a new asset
    on every poll.

Before vs. after

Authentication — before, scripts base64-encoded basic auth and hand-built bearer headers:

# before
import_b64 = base64.encode(user + ":" + password)
headers = {"Authorization": "Basic " + import_b64}
# now
load("http", "basic", "bearer", "oauth2_token")
headers = {"Authorization": basic(user, password)}        # or bearer(token)
token = oauth2_token(token_url=..., client_id=..., client_secret=...)  # client_credentials in one call

Fetching JSON with retries/pagination — before, every script re-implemented status
checks, JSON decoding, and backoff:

# before
resp = http_get(url, headers=headers)
if resp.status_code != 200:
    return []
data = json_decode(resp.body)
# now: retries 408/425/429/5xx with backoff, honors Retry-After, returns (data, err)
load("http", "get_json")
data, err = get_json(url, headers=headers, params={"limit": 100})
if err:
    print("fetch failed:", err)
    return []

Reading credentials — before, raw kwargs.get(...) with manual casting; now typed,
validating accessors:

# now
load("kwargs", "require", "get_int", "get_bool", "get_list")
require(kwargs, "client_id", "client_secret")
page_size = get_int(kwargs, "page_size", default=100)
regions   = get_list(kwargs, "regions", default=[])   # CSV string or list -> list

Building network interfaces — before, scripts looped to classify v4/v6 and normalize
MACs; now one helper does it (mixed list, addr:port/%zone stripping, dedupe, caps):

# now
load("net", "network_interface")
nic = network_interface(mac="AA:BB:CC:DD:EE:FF", ips=["10.0.0.5", "fe80::1%eth0"])

New capabilities

Self-describing scripts (embedded CONFIG). Each script now declares a top-level
CONFIG = {...} literal with its id/name/type, version, optional minVersion,
and credential params. The platform renders the form from it, applies defaults, coerces
and validates types (required/min/max/pattern/enum), and routes type: "secret"
fields through encrypted storage. Shared OPTIONS_HTTP/OPTIONS_TLS includes give every
integration consistent connection/TLS controls without copy-paste. This replaces the old
config.json metadata files, which have been removed.

Reach beyond HTTP. New modules open raw connections to sources without a REST API:

  • socket (tcp/udp/tls), runzero.ssh, runzero.smb, runzero.winrm, runzero.wmi
  • runzero.sql for Postgres/MySQL/SQL Server (parameterized query/exec)

Connections opened by a script are tracked and closed automatically when the run ends.

A real standard library. re (RE2 regex), xml, csv, jsonstream (streaming large
arrays/NDJSON), jwt (encode/decode/verify), runzero.progress (progress bar + log lines
in the UI), plus crypto (hmac_*, AWS SigV4 sign_v4, random_bytes/random_hex) and
hex/base32 encodings. URL helpers (url_parse/url_join/multipart) and
http.head/http.put round out the HTTP verbs.

Richer assets and merge control.

  • runzero.types gains Service/ServiceProtocolData and a to_custom_attributes helper
    that flattens arbitrary values into the string -> string shape (nested dicts, lists,
    length caps) the platform expects.
  • matchBehavior on ImportAsset accepts a flag string so each script chooses how the
    cruncher merges — e.g. "no-mac-break no-ip-break no-name-break" when it has a stable
    foreign id, or "no-id-match no-id-break" for ephemeral ids.

What changed in this repo

  • Migrated every script to the new toolkit: to_custom_attributes(...),
    network_interface(...), get_json/post_json, basic/bearer/oauth2_token, and the
    typed kwargs accessors, removing hand-rolled flattening, header building, and pagination.
  • Added an embedded CONFIG block to every script and removed the old config.json
    metadata files. Credential field names were normalized away from the generic
    access_key/access_secret pair to descriptive keys (api_token, client_id,
    username/password, etc.) that match each API.
  • Renamed every script to drop the custom-integration- / custom_integration-
    filename prefix. Each directory now contains a <name>.star (e.g. tailscale.star,
    cisco-ise.star, boilerplate.star).
  • New integration: Kubernetes — pulls Nodes (and optional LoadBalancer/NodePort
    Services) from the Kubernetes API using a ServiceAccount bearer token.
  • Documentation: new helpers reference (docs/starlark-helpers.md), updated AGENTS.md
    and PR template for the CONFIG convention and <name>.star naming, a new
    "Asset IDs and match behavior" README section, and refreshed cross-references in
    docs/integrations.json and individual READMEs.
  • Migration and AI authoring: added a v1-to-v2 migration guide and the
    /create-custom-integration skill. The skill blocks implementation until the
    source ID's stability, uniqueness scope, and one-to-one asset cardinality are
    documented.
  • Validation: direct-protocol scripts declare validationMode: "compile",
    while HTTP integrations use the local wiring check. Catalog generation is
    deterministic across repeated runs.

Match behavior reference

ImportAsset accepts an optional matchBehavior string. The default matches and breaks on
all four dimensions (id, MAC, IP, name), which is correct when the integration owns a strong
id. When the id is weak or absent, use the knobs below to tell the cruncher which dimensions
are unreliable for matching (finding the right existing asset to merge into) and which
are unreliable for breaking (refusing a merge that one dimension would otherwise block).

Flag Effect
no-id-match Do not use the foreign id to find candidate assets to merge with.
no-id-break Allow a merge even when the foreign id differs from the existing asset.
no-mac-match Do not use MAC addresses to find merge candidates.
no-mac-break Allow a merge even when MAC addresses conflict.
no-ip-match Do not use IP addresses to find merge candidates.
no-ip-break Allow a merge even when IP addresses conflict.
no-name-match Do not use hostnames to find merge candidates.
no-name-break Allow a merge even when hostnames conflict.

Combine flags with spaces. Recommended presets:

  • Strong, stable foreign id (most cloud / EDR / MDM APIs): leave matchBehavior unset.
    The default uses every signal.
  • Strong id, but the source also reports churny MAC/IP/hostnames (ephemeral cloud
    workloads, VPN clients): matchBehavior="no-mac-break no-ip-break no-name-break". Keeps
    id-based merging authoritative, but stops drift in the other dimensions from blocking a
    legitimate merge.
  • No stable id at all (the source only emits per-run / ephemeral ids):
    matchBehavior="no-id-match no-id-break". Use a documented deterministic,
    namespaced composite and require a usable MAC, IP, or hostname for correlation.
    If no safe identity or correlation signal exists, skip the record; never use a
    random ID fallback.
  • Two-stage enrichment where one integration owns "identity" and another only contributes
    attributes: use no-id-match no-id-break on the enrichment-only integration so it always
    merges into the primary asset by MAC/IP/name rather than creating a parallel record.

Rule of thumb: if the upstream id is not both stable and unique, relax id matching. If
MAC / IP / hostname are known to be unreliable for this source, relax the corresponding
-break flags so a conflict there doesn't fragment one real asset into many.


Safety notes for authors

  • Dynamic credential values are encrypted at rest. Known credential values are
    redacted from script print/progress output as a secondary control; scripts must
    not intentionally log credentials or transformed secret values.
  • SQL DSNs are restricted to network-only access; jwt rejects the none algorithm;
    xml.parse is XXE-safe.
  • Long-running builtins (HTTP/socket/SSH/SQL) honor the task's wall-clock deadline and are
    cleaned up on cancel.

Docs

Authoring guidance and a runnable example that exercises the new helpers live in this repo:
the helpers reference (docs/starlark-helpers.md), AGENTS.md, and
boilerplate/boilerplate.star.

@hdm
hdm marked this pull request as draft May 21, 2026 07:31
@hdm
hdm force-pushed the custom-integrations-5.0 branch from d0db9f0 to 75fd2b6 Compare June 9, 2026 06:25
- Migrate integrations to runZero 5.0 API
- Add incremental asset reporting via report_assets()
- Remove deprecated/unused functions
- Bug fixes and regenerated integrations JSON/README
@hdm
hdm force-pushed the custom-integrations-5.0 branch from 3ff0dc5 to 341af67 Compare June 10, 2026 06:15
This was referenced Jun 10, 2026
@hdm hdm self-assigned this Jun 10, 2026
@hdm hdm changed the title Updates for runZero 5.0 Updates for runZero 5.1 Jun 11, 2026
@hdm

hdm commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

placeholder of 5.1 until we pick the revision for this (to enable version compat checks)

@hdm
hdm marked this pull request as ready for review July 20, 2026 07:49
@hdm
hdm requested a review from Copilot July 20, 2026 07:50
@hdm
hdm merged commit 1900907 into main Jul 20, 2026
2 checks passed
@hdm
hdm deleted the custom-integrations-5.0 branch July 20, 2026 07:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the repository’s custom integrations to the runZero 5.1 “v2” Starlark surface by moving integration metadata into embedded CONFIG blocks, adopting the new helper/builtin modules, and refactoring many integrations to stream assets page-by-page via report_assets for better memory behavior.

Changes:

  • Refactors multiple integrations to use CONFIG, typed kwargs accessors, get_json/post_json, network_interface, and to_custom_attributes, with wider adoption of streaming via report_assets.
  • Removes legacy per-integration config.json metadata and various custom-integration-*.star scripts, replacing them with renamed <integration>.star scripts.
  • Updates docs and tooling (catalog generation script, PR template, migration guide) to align with the 5.1 conventions.

Reviewed changes

Copilot reviewed 151 out of 151 changed files in this pull request and generated no comments.

Show a summary per file
File Description
windows-wmi/README.md Adds documentation for the Windows WMI integration parameters and usage.
windows-smb-shares/windows-smb-shares.star Adds a new SMB share enumeration integration using runzero.smb.
windows-smb-shares/README.md Documents authentication and output for the SMB shares integration.
wazuh/README.md Updates credential/parameter naming guidance for v2 fields.
wazuh/config.json Removes legacy integration metadata file.
vulnerability-workflow/custom-integration-vulnerability-workflow.star Removes legacy workflow script in favor of v2 replacement.
vulnerability-workflow/config.json Removes legacy integration metadata file.
ubiquiti-unifi-network/README.md Updates docs to use api_key instead of legacy access fields.
ubiquiti-unifi-network/config.json Removes legacy integration metadata file.
task-sync/custom-integration-task-sync.star Removes legacy task sync script in favor of v2 replacement.
task-sync/config.json Removes legacy integration metadata file.
tanium/tanium.star Migrates Tanium integration to embedded CONFIG, helper HTTP, streaming, and to_custom_attributes.
tanium/README.md Updates docs to use api_token field.
tanium/config.json Removes legacy integration metadata file.
tailscale/README.md Updates docs for new credential field names.
tailscale/config.json Removes legacy integration metadata file.
sumo-logic/sumo.star Adds v2 outbound exporter to Sumo Logic with embedded CONFIG.
sumo-logic/README.md Updates docs to use runzero_export_token.
sumo-logic/custom-integration-sumo.star Removes legacy Sumo integration script.
sumo-logic/config.json Removes legacy integration metadata file.
stairwell/stairwell.star Migrates Stairwell integration to embedded CONFIG, streaming via report_assets, and standard helpers.
stairwell/README.md Updates credential field naming for v2.
stairwell/config.json Removes legacy integration metadata file.
solarwinds-information-service/swis.star Adds v2 SWIS integration using get_json and streaming.
solarwinds-information-service/README.md Updates docs to use username/password fields.
solarwinds-information-service/custom-integration-swis.star Removes legacy SWIS integration script.
solarwinds-information-service/config.json Removes legacy integration metadata file.
snow-license-manager/README.md Updates docs to use username/password fields.
snow-license-manager/config.json Removes legacy integration metadata file.
snipe-it/snipe-it.star Migrates Snipe-IT integration to embedded CONFIG, helper HTTP, and streaming import.
snipe-it/README.md Updates docs to use api_token.
snipe-it/config.json Removes legacy integration metadata file.
scripts/generate_integration_json.py Updates catalog generator to read embedded CONFIG instead of config.json, and stabilizes lastUpdated when unchanged.
scan-passive-assets/config.json Removes legacy integration metadata file.
scale-computing/scale-computing.star Adds embedded CONFIG, supports new structured kwargs with legacy fallback, and streams assets via report_assets.
scale-computing/README.md Updates docs to reflect v2 parameter fields and legacy fallback format.
scale-computing/config.json Removes legacy integration metadata file.
runzero-vulnerability-workflow/vulnerability-workflow.star Adds v2 internal vulnerability workflow integration using helper HTTP and CONFIG.
runzero-vulnerability-workflow/README.md Documents new parameter names for the workflow integration.
runzero-task-sync/task-sync.star Adds v2 task sync integration with split src/dst options/includes and helper HTTP usage.
runzero-task-sync/README.md Updates docs to use src_api_token/dst_api_token.
runzero-scan-passive-assets/scan-passive-assets.star Migrates passive-scan helper to embedded CONFIG, base URL parameterization, and JSON request bodies.
runzero-scan-passive-assets/README.md Updates docs to use org_api_token.
proxmox/README.md Updates docs for new api_token_id/api_token_secret fields and legacy fallback naming.
proxmox/proxmox.star Adds embedded CONFIG, structured kwargs with legacy fallback, and streams assets via report_assets.
proxmox/config.json Removes legacy integration metadata file.
pfsense/README.md Updates docs to new script naming and v2 credential fields.
pfsense/config.json Removes legacy integration metadata file.
ninjaone/README.md Updates docs to client_id/client_secret fields.
ninjaone/custom-integration-ninjaone.star Removes legacy NinjaOne integration script.
ninjaone/config.json Removes legacy integration metadata file.
nexthink/README.md Updates docs for v2 script name and parameterization.
nexthink/config.json Removes legacy integration metadata file.
netskope/README.md Updates docs to use api_token.
netskope/netskope.star Adds v2 Netskope integration with embedded CONFIG and streaming.
netskope/custom-integration-netskope.star Removes legacy Netskope integration script.
netskope/config.json Removes legacy integration metadata file.
mssql-databases/README.md Adds documentation for SQL Server database inventory integration.
mssql-databases/mssql-databases.star Adds v2 SQL Server integration using runzero.sql and streaming.
moysle/README.md Updates docs for Mosyle v2 fields and legacy support.
moysle/moysle.star Migrates Mosyle integration to embedded CONFIG, streaming, and new credential field names.
moysle/config.json Removes legacy integration metadata file.
manage-engine-endpoint-central/README.md Updates docs for v2 url/oauth_token fields.
manage-engine-endpoint-central/endpoint-central.star Migrates Endpoint Central integration to embedded CONFIG and streaming via report_assets.
manage-engine-endpoint-central/config.json Removes legacy integration metadata file.
linux-ssh/README.md Adds documentation for SSH-based Linux host fact collection integration.
linux-ssh/linux-ssh.star Adds v2 SSH-based Linux integration using runzero.ssh.
lima-charlie/README.md Updates docs for v2 organization_id/api_token fields.
lima-charlie/lima-charlie.star Migrates LimaCharlie integration to embedded CONFIG and streaming.
lima-charlie/config.json Removes legacy integration metadata file.
LICENSE Updates copyright holder/year range for MIT license.
kubernetes/README.md Adds documentation for Kubernetes integration and ServiceAccount setup.
kubernetes/config.json Removes legacy integration metadata file.
kandji/README.md Updates docs to use v2 url/api_token fields and removes subdomain-only guidance.
kandji/kandji.star Adds v2 Kandji integration with embedded CONFIG and streaming with per-device detail fetches.
kandji/custom-integration-kandji.star Removes legacy Kandji integration script.
kandji/config.json Removes legacy integration metadata file.
jamf/README.md Updates docs to use client_id/client_secret fields.
jamf/config.json Removes legacy integration metadata file.
ivanti_neurons/README.md Updates docs for v2 OAuth field names.
ivanti_neurons/neurons.star Adds v2 Ivanti Neurons integration with embedded CONFIG and streaming.
ivanti_neurons/custom-integration-neurons.star Removes legacy Ivanti Neurons integration script.
ivanti_neurons/config.json Removes legacy integration metadata file.
halycon/README.md Simplifies docs to username/password-only auth model.
halycon/config.json Removes legacy integration metadata file.
ghost/README.md Updates docs to use api_token and new script name.
ghost/ghost.star Migrates Ghost Security integration to embedded CONFIG and streaming via report_assets.
ghost/config.json Removes legacy integration metadata file.
extreme-cloud-iq/README.md Updates docs for v2 username/password fields.
extreme-cloud-iq/extreme-cloud-iq.star Migrates Extreme CloudIQ integration to embedded CONFIG and streaming.
extreme-cloud-iq/config.json Removes legacy integration metadata file.
drata/README.md Updates docs to use api_token.
drata/drata.star Migrates Drata integration to embedded CONFIG and streaming.
drata/config.json Removes legacy integration metadata file.
docs/migration-v1-to-v2.md Adds a migration guide describing CONFIG rules, helpers, streaming, and testing.
digital-ocean/README.md Updates docs to use api_token.
digital-ocean/digital-ocean.star Adds v2 DigitalOcean integration with embedded CONFIG and streaming.
digital-ocean/custom-integration-digital-ocean.star Removes legacy DigitalOcean integration script.
digital-ocean/config.json Removes legacy integration metadata file.
device42/README.md Updates docs to new auth field names.
device42/device42.star Migrates Device42 integration to embedded CONFIG and streaming.
device42/config.json Removes legacy integration metadata file.
cyberint/cyberint.star Migrates Cyberint integration to embedded CONFIG, base URL param, and streams assets.
cyberint/config.json Removes legacy integration metadata file.
cortex-xdr/README.md Updates docs to use api_key/api_key_id.
cortex-xdr/cortex-xdr.star Migrates Cortex XDR integration to embedded CONFIG and streaming endpoint import.
cortex-xdr/config.json Removes legacy integration metadata file.
cisco-ise/README.md Updates docs to new basic-auth credential field naming.
cisco-ise/config.json Removes legacy integration metadata file.
cisco-ise/cisco-ise.star Migrates Cisco ISE integration to embedded CONFIG, kwargs http options, and streaming.
carbon-black/README.md Updates docs to new org/api key naming.
carbon-black/config.json Removes legacy integration metadata file.
boilerplate/README.md Updates boilerplate docs to match v2 credential naming guidance.
boilerplate/custom-integration-boilerplate.star Removes legacy boilerplate script.
boilerplate/config.json Removes legacy integration metadata file.
bitsight/README.md Updates docs to require company_id and api_token.
bitsight/config.json Removes legacy integration metadata file.
automox/README.md Updates docs to use api_token (and optional org hint).
automox/config.json Removes legacy integration metadata file.
audit-events-to-webhook/README.md Updates docs for v2 script name and legacy credential field.
audit-events-to-webhook/custom-integration-audit-events.star Removes legacy audit-events script.
audit-events-to-webhook/config.json Removes legacy integration metadata file.
audit-events-to-webhook/audit-events.star Adds v2 outbound audit-log forwarder with embedded CONFIG and legacy credential support.
akamai-guardicore-centra/README.md Updates docs to username/password fields.
akamai-guardicore-centra/config.json Removes legacy integration metadata file.
.github/skills/create-custom-integration/references/identity-decision.md Adds an identity decision record template for asset ID stability/uniqueness.
.github/pull_request_template.md Updates PR checklist to require embedded CONFIG instead of config.json.
Comments suppressed due to low confidence (3)

moysle/moysle.star:222

  • network_interface() is called with MAC and IP arguments swapped, which will produce invalid/empty interfaces (and may raise if the helper validates types).
    moysle/moysle.star:226
  • network_interface() is called with MAC and IP arguments swapped, which will produce invalid/empty interfaces (and may raise if the helper validates types).
    cisco-ise/cisco-ise.star:86
  • network_interface() helper expects an ips list (as used throughout this repo), but this calls it with an ip= keyword. This will likely raise an unexpected-kwarg error at runtime.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants